package com.itheima.day09;

import java.util.ArrayList;

public class TestClassCase03 {

    public static void main(String[] args) {

        ArrayList<String> list = new ArrayList<>();

        //1.add()添加元素
        list.add("张一");
        list.add("张二");
        list.add("张三");
        list.add("张五");

        System.out.println(list);

        //2.remove() 删除元素
        //  list.remove("张五");
        //删除指定位置元素
        list.remove(3);
        System.out.println(list);

        //3.set()修改元素
        list.set(1, "marry");
        System.out.println(list);

        //4.get()查询元素
        String s = list.get(2);
        System.out.println(s);

        //5.size()获取集合元素个数
        int size = list.size();
        System.out.println(size);


    }
}
